<template>
  <div>
    <h2><slot></slot></h2>

    <button @click="onClick">Increase age</button>
    <button @click="onClick2">Set name</button>
  </div>
</template>

<script>
export default {
  name: 'ModuleMutations1',
  methods: {
    onClick() {
      // 通过 commit 访问 mutations
      this.$store.commit('userModule/increaseAge')
    },
    onClick2() {
      // 参数
      this.$store.commit('userModule/setName', '张智琦2')
    }
  }
}
</script>
